
# 这个镜像包含了open5gs编译的必要库
function apt_update() {
    echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse" > /etc/apt/sources.list
        #  echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse" >> /etc/apt/sources.list
         echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse" >> /etc/apt/sources.list
        #  echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse" >> /etc/apt/sources.list
         echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list
        #  echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list
         echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse" >> /etc/apt/sources.list
        #  echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse" >> /etc/apt/sources.list
         echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list
        #  echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list
      apt update
}
function install() {

     apt install -y python3-pip

     pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
     pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple


    #  pip3 install pymongo  requests
    #   apt install -y python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev meson mongodb python3 git libtalloc-dev meson
    #  apt install -y libmysqlclient-dev mysql-client

    # 用来测试得工具包
     apt install -y iproute2 netbase pkg-config ca-certificates
     apt install -y curl iptables net-tools vim iputils-ping sudo git

    # 安装ssh
    # apt install -y ssh && echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
    # echo "root:123123" | chpasswd
    # echo 'sshd: ALL' >> /etc/hosts.allow
    #  sudo /etc/init.d/ssh start
    #  service ssh start

    #  curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
    #  apt install -y nodejs
    apt install -y openjdk-8-jdk

    cd
    wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
    tar xzvf apache-maven-3.8.6-bin.tar.gz
}

function set_path(){
      JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
      echo "JAVA_HOME=$JAVA_HOME" >> ~/.bashrc
      echo "JRE_HOME=${JAVA_HOME}/jre" >> ~/.bashrc
      echo "CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar" >> ~/.bashrc
      echo "PATH=${JAVA_HOME}/bin:$PATH" >> ~/.bashrc
      echo "PATH=/root/apache-maven-3.8.6/bin:$PATH" >> ~/.bashrc
}

#apt_update

#install

set_path